<?php get_header(); ?>
<div id="box">
    <div id="container">
        
        <div id="content">
            <?php
            if (have_posts()) :
                while (have_posts()) : the_post();
                    global $post;
                    $array_img = get_images_src('medium', false, $post->ID);
                    //$array_img = get_multi_images_src('medium','full',false,$post->ID);
                    ?>
                    <div class="tit-pro"><h3><?php the_title(); ?></h3></div>
                    <div class="col50">
                        <div class="zoom-section">  
                            <div class="zoom-small-image">
                                <?php
                                $i = 1;
                                foreach ($array_img as $img) {
                                    ?>                   
                                    <a href='<?= $img[0] ?>' class = 'cloud-zoom' id='zoom<?= $i; ?>' rel="adjustX: 10, adjustY:-4">
                                        <img src="<?= $img[0] ?>" width='150' height='150' alt='' title="<?php the_title(); ?>" />
                                    </a>                                                                                                       
                                    <?php
                                    $i++;
                                    break;
                                }
                                ?>
                            </div>             
                            <div class="zoom-desc">        
                                <?php
                                $i = 1;
                                foreach ($array_img as $img) {
                                    ?>
                                    <a href='<?= $img[0] ?>' class='cloud-zoom-gallery' title='<?php the_title(); ?>' rel="useZoom: 'zoom1', smallImage: ' <?= $img[0] ?>'">
                                        <img src="<?= $img[0] ?>" width='70' height='70' alt='Thumbnail <?= $i ?>' class='zoom-tiny-image'  title="Optional title display" />
                                    </a>  
                                    <?php
                                    $i++;
                                }
                                ?>                                
                            </div>
                        </div>
                    </div> 
                    <div class="col50">
                        <div id="box-price">
                            <p>Giá: <span class="price"><?php echo get_post_meta($post->ID, 'price', true); ?></span></p>
                            <p>Hãng sản xuất: <span class="price"><?php echo get_post_meta($post->ID, 'price', true); ?></span></p>
                            <p>Bảo hành:  <span class="price"><?php echo get_post_meta($post->ID, 'price', true); ?></span></p>
                            <p>Khuyến mãi: <span class="price"><?php echo get_post_meta($post->ID, 'price', true); ?></span></p>
                        </div>
                        <div id="contact">
                            <h3 style="color: #000;">LIÊN HỆ MUA HÀNG</h3>
                            <p style="color:#ff7171;">Tel: 0240 3 585 681 - Hotline: 0936 860 188</p>
                        </div>                       
                    </div>
                    <div class="clear"></div>
                    <?php
                    // set post views
                    setPostViews(get_the_ID());
                endwhile;
            endif;
            ?>    
            <div id="product">
                <div class="tit-pro"><h3>Typical products</h3></div>
                <ul class="items-pro">
                    <?php
                    global $post;
                    $i = 1;
                    $query_loop = array(
                        'post_type' => 'product',
                        'posts_per_page' => 20
                    );
                    $loop = new WP_Query($query_loop);
                    while ($loop->have_posts()):$loop->the_post();
                        if ($i % 4 == 1) {
                            ?>                            
                            <li class="item-pro">
                                <ul>
                                <?php } ?>
                                <li>
                                    <?php the_post_thumbnail(); ?>
                                    <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?> 
                                        </a></p>
                                    <p>Giá: <span class="price"><?php echo get_post_meta($post->ID, 'price', true); ?></span></p>
                                </li>
                                <?php
                                if ($i % 4 == 0) {
                                    ?> </ul><div class="clear"></div><div class="hr"></div></li>
                                    <?php
                                }
                                $i++;
                            endwhile;
                            wp_reset_query();
                            ?>
                </ul>
            </div>
            <div class="clear"></div>

        </div><!--end col7-->
        <div id="sidebar">
            <? get_sidebar(); ?>
        </div>
        <div class="clear"></div>
        <div id="bottom">
            <div class="l">
                <h4>SEAWEALTH VN COMPANY LIMITED</h4>
                <p>Address: 121 LY Tu Trong Street, 3 ward, Vung  Tau city, Viet Nam</p>
                <p>Phone: 0646 250 579 - 568 - 679</p>
                <p>Email: info@namviet-it.com</p> 
            </div>
            <div class="r">
                <?php
                wp_nav_menu(array(
                    'theme_location' => 'secondary-menu',
                    'menu_id' => 'bot-nav')
                );
                ?> 
                <p>Copyright 2013 by <a href="http://localhost/seafood/">http://seawealthvn.com.</a> Allright Reserved.</p>
                <p class="r">Design by <a href="http://namviet-it.com">namviet</a></p>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
        </div> 
    </div>

</div>
<?php get_footer(); ?>